﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Transformer.iHunter.Plugins
{


    /// <summary>
    /// The platform that the plugin runs on
    /// </summary>
    public enum Platform
    {
        /// <summary>
        /// The plugin can run on any CLR platform
        /// </summary>
        Generic = 0,
        /// <summary>
        /// The plugin can run on Microsoft(R) Windows
        /// </summary>
        Windows,
        /// <summary>
        /// The plugin can run on Linux
        /// </summary>
        Linux,
        /// <summary>
        /// The plugin can run on MacOS
        /// </summary>
        MacOS
    }

    /// <summary>
    /// Define the platform that the plugin runs on
    /// </summary>
    public class PlatformAttribute : Attribute
    {
        private Platform platform;

        /// <summary>
        /// Gets the compatible platform.
        /// </summary>
        /// <value>The platform.</value>
        public Platform Platform
        {
            get { return platform; }
        }

        private Version minimumVersion;

        /// <summary>
        /// Gets the minimum required platform version to run the plugin.
        /// </summary>
        /// <value>The minimum version.</value>
        public Version MinimumVersion
        {
            get { return minimumVersion; }
        }

        private string subPlatform;

        /// <summary>
        /// Gets the requried sub platform.
        /// </summary>
        /// <value>The sub platform.</value>
        public string SubPlatform
        {
            get { return subPlatform; }
        }
        private Version subPlatformVersion;

        /// <summary>
        /// Gets the minimum required sub platform version.
        /// </summary>
        /// <value>The sub platform version.</value>
        public Version SubPlatformVersion
        {
            get { return subPlatformVersion; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformAttribute"/> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        public PlatformAttribute(Platform platform)
        {
            this.platform = platform;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformAttribute"/> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="minimumVersion">The minimum version.</param>
        public PlatformAttribute(Platform platform, Version minimumVersion)
            : this(platform)
        {
            this.minimumVersion = minimumVersion;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformAttribute"/> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="minimumVersion">The minimum version.</param>
        /// <param name="subPlatform">The sub platform.</param>
        public PlatformAttribute(Platform platform, Version minimumVersion, string subPlatform)
            :this(platform,minimumVersion)
        {
            this.subPlatform = subPlatform;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="PlatformAttribute"/> class.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="minimumVersion">The minimum version.</param>
        /// <param name="subPlatform">The sub platform.</param>
        /// <param name="subPlatformVersion">The sub platform version.</param>
        public PlatformAttribute(Platform platform, Version minimumVersion, string subPlatform, Version subPlatformVersion)
            : this(platform, minimumVersion, subPlatform)
        {
            this.subPlatformVersion = subPlatformVersion;
        }
    }
}
